package Practica

class Trip {
    String name
    String city
    Date startDate
    Date endDate
    String purpose
    String notes
    Budget budget
    
    static belongsto = [owner :User]
    static hasOne = [budget:Budget]

    static constraints = {
        name blank:false, size:3..15, unique : true   //6.d
        city blank:false
        startDate min: new Date()          //-|
        endDate min: new Date()            //-| 6.a
        
        purpose blank : false ,inList : ["Pleasure","Education","Bussines",
                                        "Scientific", "Political"]  //6.b 6.e
        notes blank : false                //
       
    }
    
    String toString(){
        "${name}"
    }
}
